Fixed OSX sys_read to not call select if IO is non-blocking
authorSteven Tamm <steventamm@mac.com>
Tue, 10 Dec 2002 16:47:49 +0000 (16:47 +0000)
committerSteven Tamm <steventamm@mac.com>
Tue, 10 Dec 2002 16:47:49 +0000 (16:47 +0000)
src/mac.c

index 439f900db5b4694b88765e6f3aee83566679f2bf..bf1915cbacd4be3c7c8aba7e0998e56359f1e372 100644 (file)
--- a/src/mac.c
+++ b/src/mac.c
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA.  */
 #include <pwd.h>
 #include <sys/param.h>
 #include <stdlib.h>
+#include <fcntl.h>
 #if __MWERKS__
 #include <unistd.h>
 #endif
@@ -2811,7 +2812,8 @@ int sys_read (fds, buf, nbyte)
   int r;
 
   /* Use select to block on IO while still checking for quit_char */
-  if (!inhibit_window_system && !noninteractive)
+  if (!inhibit_window_system && !noninteractive &&
+      ! (fcntl(fds, F_GETFL, 0) & O_NONBLOCK))
     {
       FD_ZERO (&rfds);
       FD_SET (fds, &rfds);